<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>样式绑定3</title>
    <script src="./vue.js"></script>
</head>
<body>
<div id="app">
    <div @click="handleDivClick" :style="[styleObj,{fontSize: '25px'}]">Style Bind</div>
</div>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            styleObj: {
                color: "black"
            }
        },
        methods: {
            handleDivClick: function () {
                this.styleObj.color = this.styleObj.color === "black" ? "red" : "black"
            }
        }
    });
</script>
</body>
</html>